package com.linkgie.galaxyframework.httpproxy.converters;

import com.linkgie.galaxyframework.httpproxy.ResponseHandler;
import com.linkgie.galaxyframework.httpproxy.ServiceInvocationContext;
import com.linkgie.galaxyframework.httpproxy.ServiceRequest;
import com.linkgie.galaxyframework.httpproxy.ServiceResponse;

public class IntegerResponseHandler implements ResponseHandler {

    public static final IntegerResponseHandler INSTANCE = new IntegerResponseHandler();

    private IntegerResponseHandler() {
    }

    @Override
    public Object handleResponse(ServiceRequest request, ServiceResponse response,
            ServiceInvocationContext invocationContext) throws Exception {
        String content = StringResponseHandler.INSTANCE.handleResponse(request, response, invocationContext);
        return Integer.parseInt(content);
    }

}
